package Chpter4;

interface Animal11{
	void shout();
}

class Cat11 implements Animal11{
	public void shout() {
		System.out.println("maio");
	}
	void sleep() {
		System.out.println("sleep");
		
	}
}

class Dog11 implements Animal11{
	public void shout() {
		System.out.println("wang");
	}
}

public class Example15 {
	public static void main(String[] args) {
		Dog11 dog=new Dog11();
		animalShout(dog);
	}
	public static void animalShout(Animal11 an) {
		if(an instanceof Cat11) {
			Cat11 cat=(Cat11)an;
			cat.sleep();
			cat.shout();
		}else {
			System.out.println("This is not a cat.");
		}
	}

}
